home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
014
/
columns3.arc
/
COLUMNS.DOC
< prev
Wrap
Text File
|
1986-07-07
|
11KB
|
361 lines
COLUMNS 3.0 July 1, 1986
DESCRIPTION:
===========
COLUMNS is a general purpose MS-DOS filter that reads a sequential input
file, reformats it in a columnar fashion, and writes the result to a new
sequential file. It reads the input file from standard in, and sends the
output file to standard out. This allows it to be used with MS-DOS
piping. It is driven by a control file and produces a small report of
statistics or errors back to the standard error device, normally the
terminal. It supports both character and hex input for columns to be
inserted in the output file.
(C) Copyright 1986 by Bill Prew, ALL RIGHTS RESERVED
Please refer all inquiries to:
Bill Prew
1615 Pawtucket Ave
Rumford RI 02916
You may copy and distribute this program freely, provided that:
<1> No fee is charged for such copying and distribution, and
<2> It is distributed ONLY in its original, unmodified state.
This program is being distributed as user supported software. If you
like this program, and find it of use, then your contribution will be
appreciated. If you are using this product in a commercial environment,
then the contribution is not voluntary. If you would like the source for
the program send a mailer and $10 to the address above with a formatted
floppy.
USAGE:
=====
The command format to execute the program is;
COLUMNS <input-filename >output-filename control-filename
where input-filename is the input file, output-filename is the newly
created file after all column commands have been applied, and
control-filename is the name of the file that contains the replace
commands and options.
CONTROL CARD FORMATS:
====================
The general format of the control cards is;
type,parms
where type can be "opts", "cols", "text" or "hex" as discussed below, and
parms are different parameters and information needed by the different
control cards.
Page 1
COLUMNS 3.0 July 1, 1986
"OPTS" CONTROL CARD:
-------------------
This card selects several options for the run with the format;
opts,[pad | nopad]
pad ............... this preserves trailing spaces in the output
records.
nopad ............. this causes all trailing spaces to be eliminated
from the output records before they are written
(this is the default).
"COLS" CONTROL CARD:
--------------------
This is the most used card in columns control files and specifies a
set of columns to be moved to the output record. The output line is
built in a left to right fashion depending on the control cards
specified.
cols,start-column,number
start-column ...... this specifies the character position (relative
to one) in the input record to start moving to
the output record.
number ............ this is the number of columns (starting at
start-column) that will be moved to the output
line for each record.
"TEXT" CONTROL CARD:
--------------------
This card is used to insert new text strings in the output records at
the current column.
text,'insert-string'
' ................. notice the three single quotes in the parms.
this is the delimiter and bounds the new and old
strings. it can be any character, as long as
both are the same.
insert-string ..... this is the new text to insert into the output
record at the current column.
"HEX" CONTROL CARD:
-------------------
This card is used to insert new text strings in the output records at
the current column. This card is very similar to the "text" card
except it allows you to specify the old and new strings as hex data.
The format is;
Page 2
COLUMNS 3.0 July 1, 1986
hex,insert-hex-string
insert_hex_string . this is the new text to insert into the output
record at the current column, in hex format. for
example 414243 would place ABC into aech output
record at the current column.
EXAMPLES:
=========
EXAMPLE 1:
----------
COLUMNS <in >out columns.ctl
columns.ctl ....... text,'XXXX'
cols,1,4
hex,3132333435
in ................ YYYY
ZZZZ
out ............... XXXXYYYY12345
XXXXZZZZ12345
This is pretty straight forward, the output record is built up from
the string "XXXX", then columns 1 through 5 of the input record, and
finaly the string "12345".
EXAMPLE 2:
----------
COLUMNS <in >out columns.ctl
columns.ctl ....... cols,1,4
hex,0d0a
cols,5,4
hex,0d0a
in ................ AAAABBBB
CCCCDDDD
out ............... AAAA
BBBB
CCCC
DDDD
This is a little trickier. By inserting a line-feed carraige-return
between the first 4 columns and the second four columns we actually
split the input line into two output lines.
EXAMPLE 3:
----------
Page 3
COLUMNS 3.0 July 1, 1986
COLUMNS <in >out columns.ctl
columns.ctl ....... text,'copy '
cols,1,8
text,'.old '
cols,1,8
text,'.new'
in ................ file1
file2
file3
out ............... copy file1 .old file1 .new
copy file2 .old file2 .new
copy file3 .old file3 .new
Notice that you can reuse the same columns from the input record
multiple times in the output record.
EXAMPLE 4:
----------
FILATR a: | COLUMNS >out columns.ctl
replace.ctl ....... cols,22,9
text,' ---> '
cols,1,12
FILATR output ..... MS-DOS File Attribute Utility version 2.12
loader.sys . S R H .
io.sys . S R H .
msdos.sys . S R H .
command.com . . . . .
config.sys A . . . .
autoexec.bat . . . . .
6 files
out ............... Utility ---> MS-DOS File
ty --->
. S R H . ---> loader.sys
. S R H . ---> io.sys
. S R H . ---> msdos.sys
. . . . . ---> command.com
A . . . . ---> config.sys
. . . . . ---> autoexec.bat
. . --->
. . ---> 6 files
This example demonstrates the support of piping to pass the output
from one command into the COLUMNS program.
Page 4
COLUMNS 3.0 July 1, 1986
NOTES:
=====
<1> The input record is not altered as the program rebuilds the
output line, so it is possible to have column ranges that overlap, or
use the same input line columns more than once in the control file.
LIMITS:
======
Maximum input/output record length = 2000 bytes
Maximum number of control cards = 100
Maximum length of strings on 'text'/'hex' control cards = 100 bytes
Binary data is supported with the exception of line-feed chars, as
these are used as in MS-DOS to end logical records in the sequential
file. These will confuse the program if they exist in the input
record.
RELEASE INFO:
============
RELEASE 3.0
<1> The program was completely re-written using Lattice version 3.0
for speed and added flexibility. This release runs 3 to 10 times
faster than release 2.0.
<2> The program was changed to support MS-DOS redirection and piping
for it's input and output filenames. It now reads it's input from
Standard Input and writes it's output to Standard Output.
<3> The program now supports record lengths up to 2000 characters in
length.
<4> The control card format was changed slightly to allow any
character to be used as the text string delimiter. This allows
double quotes to be part of the replace strings by using some other
delimiter character.
RELEASE 2.0
<1> The statistics are now displayed directly to the screen instead
of being written to the COLUMNS.PRN file.
<2> The control file name no longer has to be COLUMNS.CTL. Any
filename can be entered on the command line such as "COLUMNS
TEST.CTL". If no name is entered, COLUMNS.CTL is still used by
default.
<3> The program has been re-written a bit and now runs in almost half
the time of the initial version.
Page 5
COLUMNS 3.0 July 1, 1986
<4> Error reporting has been greatly improved.
RELEASE 1.0
<1> This was the initial release.
Page 6